package design_pattern.decorator.test1;

/**
 * 装饰者2，继承自装饰者基础类
 *
 * 负责提供增强方法
 * "被装饰者"的传递 和 "被装饰者"原始方法的调用 抽取到父类中实现
 */
public class Decorator2 extends DecoratorBase {
    public Decorator2(Component component) {
        super(component);
    }

    @Override
    public void dosomething() {
        befor();
        super.dosomething();
        after();
    }

    private void befor(){
        System.out.println("decorator 2 befor");
    }

    private void after(){
        System.out.println("decorator 2 after");
    }
}
